/**
 * 
 */
package soa.security.mgr.service;

import java.util.List;
import java.util.Map;

import soa.security.domain.Department;
import soa.security.domain.Group;
import soa.security.domain.Person;
import soa.security.exception.OrganizationException;
import soa.security.mgr.service.base.BaseMgrService;
import soa.security.ws.base.ModelAdapter;

/**
 * @author CreGu
 *
 */
public interface GroupMgrService extends BaseMgrService, ModelAdapter<Group> {

	void addGroup(String organizationId, Group bean)
			throws OrganizationException;

	void updateGroup(String organizationId, Group a)
			throws OrganizationException;

	boolean addPersons(String organizationId, String groupId, String personIds)
			throws OrganizationException;

	boolean removePersons(String organizationId, String groupId,
			String personIds) throws OrganizationException;

	List<Group> allGroups(String organizationId) throws OrganizationException;

	List<Group> allGroups(String organizationId, Map<String, Object> parameters, boolean subTree)
			throws OrganizationException;

	List<Group> allGroups(List<Group> all, List<Group> allGroups);

	List<Group> getGroup(String organizationId, String groupId)
			throws OrganizationException;

	List<Person> allPersons(String organizationId, String groupId)
			throws OrganizationException;

	boolean addSubGroups(String organizationId, String groupId,
			String subGroupIds) throws OrganizationException;

	boolean removeSubGroups(String organizationId, String groupId,
			String subGroupIds) throws OrganizationException;

	List<Group> allSubGroups(String organizationId, String groupId)
			throws OrganizationException;

	Group findByDn(String dn) throws OrganizationException;

	boolean deleteByDn(String dn) throws OrganizationException;

	List<Department> findDepartments(String organizationId, String dn);

	void updateGroup4Mgr(String organizationId, Group model,
			String departmentIds, String personIds, String subGroupIds);

	void addGroup4Mgr(String organizationId, Group model, String departmentIds,
			String personIds, String subGroupIds);

	/**
	 * 找出所有的父类，递归
	 * 
	 * @param groupDn
	 * @return List<Group>
	 * 
	 * @author Cre.Gu at 2015年6月1日
	 */
	public List<Group> findParents(String organizationId, String groupDn,
			boolean recursive);

	List<Group> wrapGroups(List<Group> groups);

	void remove(String organizationId, String dn);
}
